package com.serkol.ams.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.serkol.ams.entity.Settings;
import com.serkol.ams.service.SettingsService;
import com.serkol.ams.mapper.SettingsMapper;
import com.serkol.constant.AuthConstant;
import com.serkol.handler.MyLambdaQueryWrapper;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
* @author Administrator
* @description 针对表【settings】的数据库操作Service实现
* @createDate 2025-02-06 17:37:52
*/
@Service
public class SettingsServiceImpl extends ServiceImpl<SettingsMapper, Settings>
    implements SettingsService{

    @Override
    public Map<String, Object> getInfo() {
        MyLambdaQueryWrapper<Settings> queryWrapper = new MyLambdaQueryWrapper<>();
        queryWrapper.select(Settings::getId, Settings::getTitle, Settings::getLoginBgId, Settings::getLogoId, Settings::getAgentType, Settings::getIcp, Settings::getColor, Settings::getTel, Settings::getUserName, Settings::getAbout,Settings::getDocumentsId);
      queryWrapper.picture(Settings::getLoginBgId).as("loginBgUrl");
      queryWrapper.picture(Settings::getLogoId).as("logoUrl");
      queryWrapper.picture(Settings::getDocumentsId).as("documentsUrl");
        queryWrapper.last("limit 1");
        Map<String, Object> map = this.getMap(queryWrapper);
        if (map != null) {
            AuthConstant.setSettingsInfo(map);
            return map;
        }else {
            return null;
        }
    }
}




